<!DOCTYPE html>
<html lang="en" class="am-touch js cssanimations">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="format-detection" content="telephone=no">
    <title>{$chapter.book.book_name}-{$chapter.chapter_name}免费阅读-{$site_name}</title>
    <meta name="description" itemprop="description" content="当前阅读的是{$chapter.book.book_name}的{$chapter.chapter_name}">
    <link rel="stylesheet" type="text/css" href="/static/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/static/css/mstyle.css">
    <script src="https://lib.baomitu.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="/static/js/index.js"></script>
</head>

<body class="bg-black">

<div class="win-pay view-pay">
    <a href="javascript:history.back();">
        <img class="win-pay-cross" src="/static/images/win-cross.png"></a>
    <p class="win-pay-title">{$chapter.chapter_name}&gt; 需付费后阅读</p>
    <p class="win-pay-subtitle">应付:<span class="win-pay-now">{$price}元</span></p>

    <div class="win-pay-btn-group">
        <a class="win-pay-btn red view-pay-btn" id="view-chapterpay-btn" href="javascript:void(0);">确认购买</a>
    </div>

    <p class="win-pay-bottom">
        <span class="win-pay-bottom-left">当前余额:</span>
        <span class="win-pay-bottom-center">{$balance}元</span>
        <span class="win-pay-bottom-right"><a href="/charge">余额不足？请先充值</a></span>
    </p>
</div>
<div class="toast" style="display:none;"></div>
<script>
    $('#view-chapterpay-btn').click(function () {
        $.post({
            url: '/buychapter',
            data: {chapter_id: '{$chapter.id}'},
            success: function (res) {
                if (res.success == 1) {
                    ShowDialog(res.msg);
                    setTimeout(function () {
                        location.href = '/{$chapter_ctrl}/{$chapter.id}';
                    },1000);
                } else {
                    ShowDialog(res.msg);
                }
            }, error: function (jqXHR, textStatus, errorThrown) {
                ShowDialog('遇到问题了');
            }
        })
    })
</script>
</body>

</html>